package com.woody.aggregate.app.web.saas;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.woody.aggregate.IdDTO;
import com.woody.aggregate.application.service.saas.SaasShopIndustryService;
import com.woody.aggregate.saas.api.SaasShopIndustryApi;

import com.woody.aggregate.saas.dto.*;
import com.woody.aggregate.saas.vo.PageQuerySaasIndustryVO;
import com.woody.aggregate.saas.vo.SaasShopIndustryVO;
import com.woody.base.model.Response;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;


@RestController
@Api(tags = "saas商圈行业")
public class SaasShopIndustryController implements SaasShopIndustryApi {

    @Resource
    private SaasShopIndustryService saasShopIndustryService;

    @Override
    public Response<Map<String, Object>> add(AddSaasShopIndustryDTO addSaasShopIndustryDTO) {
        Map<String, Object> map = saasShopIndustryService.add(addSaasShopIndustryDTO);
        return Response.success(map);
    }

    @Override
    public Response<Map<String, Object>> edit(UpdateSaasShopIndustryDTO updateSaasShopIndustryDTO) {
        Map<String, Object> map = this.saasShopIndustryService.edit(updateSaasShopIndustryDTO);
        return Response.success(map);
    }

    @Override
    public Response<Page<PageQuerySaasIndustryVO>> pageQuery(PageQuerySaasIndustryDTO pageQueryIndustryDTO) {
        Page<PageQuerySaasIndustryVO> pageQuerySaasIndustryVOPage = saasShopIndustryService.pageQuery(pageQueryIndustryDTO);
        return Response.success(pageQuerySaasIndustryVOPage);
    }

    @Override
    public Response<SaasShopIndustryVO> getById(IdDTO idDTO) {
        SaasShopIndustryVO saasShopIndustryVO = saasShopIndustryService.getById(idDTO.getId());
        return Response.success(saasShopIndustryVO);
    }

    @Override
    public Response<Long> delete(IdDTO idDTO) {
        Long id = this.saasShopIndustryService.delete(idDTO);
        return Response.success(id);
    }

    @Override
    public Response<List<SaasShopIndustryVO>> firstLevelIndustryList(QueryFirstLevelIndustryDTO queryFirstLevelIndustryDTO) {
        List<SaasShopIndustryVO> saasShopIndustryVOS = this.saasShopIndustryService.firstLevelIndustryList(queryFirstLevelIndustryDTO);
        return Response.success(saasShopIndustryVOS);
    }

    @Override
    public Response<List<SaasShopIndustryVO>> likeRightByCode(CodeQueryDTO codeQueryDTO) {
        List<SaasShopIndustryVO> saasShopIndustryVOS = this.saasShopIndustryService.likeRightByCode(codeQueryDTO);
        return Response.success(saasShopIndustryVOS);
    }
}
